package com.wc.AlgoOJ_train.train2_DP训练.c2.DPE008;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/12 17:54
 * @description 光头强的网格1
 * http://43.138.190.70:8888/p/DPE008
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int mod = (int) 1e9 + 7;

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] dp = new int[n + 1][m + 1];
        char[][] map = new char[n + 1][];
        for (int i = 1; i <= n; i++) {
            map[i] = (" " + sc.nextLine()).toCharArray();
        }
        for (int i = 1; i <= m; i++) {
            if (map[1][i] == '.') {
                dp[1][i] = 1;
            } else {
                // 当#号的时候，后面过不去了
                break;
            }
        }
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (map[i][j] == '.') {
                    dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
                }
            }
        }
        System.out.println(dp[n][m]);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }
}
